package com.webapp.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.webapp.model.Demo;
import com.webapp.vo.PageResult;
import com.webapp.vo.Result;

import lombok.extern.slf4j.Slf4j;
@Slf4j
@Controller
@RequestMapping("/demo")
public class DemoController {


	@RequestMapping("/test")
	@ResponseBody
	public Result<Demo> demoTest(Demo dto) {
		log.debug("demoTest:{}", dto.toString());
		Demo demo = new Demo();
		demo.setDemoId(3);
		demo.setPassWord("123456");
		demo.setUserName("张三");
		return Result.success(demo);
	}
	@ResponseBody
	@RequestMapping("/list")
	public Result<PageResult<Demo>> demoTestPage(Demo dto) {
		log.debug("demolist=:{}", dto.toString());
		PageResult<Demo> pageResult = new PageResult<>();
		Demo demo = new Demo();
		demo.setDemoId(3);
		demo.setPassWord("123456");
		demo.setUserName("张三");
		List<Demo> list = new ArrayList<>();
		list.add(demo);
		pageResult.setList(list);
		return Result.success(pageResult);
	}
	
}
